from pydantic import BaseModel
from typing_extensions import Optional


class ToolApi(BaseModel):

    api_mode: str

    api_key: str

    api_base_url: str

    api_endpoint: str

    model: str


class ToolFunction(BaseModel):

    name: str

    description: str

    parameters: dict


class Tool(BaseModel):
    """
    Tool class
    """
    id: str

    name: Optional[str] = None

    description: Optional[str] = None

    type: Optional[str] = None

    function: Optional[ToolFunction] = None
    """
    The function definition of the tool.
    """

    api: Optional[ToolApi] = None
    """
    The api definition of the tool.
    """
